package com.woniuxy.student.service.impl;

import com.woniuxy.commons.entity.TestQuestion;
import com.woniuxy.commons.enums.TestBankEnum;
import com.woniuxy.student.dao.TestQuestionDao;
import com.woniuxy.student.service.TestQuestionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: 曾令忠
 * @Description:
 * @Date: 2020/7/18 0018-下午 2:26
 */
@Service
public class TestQuestionServiceImpl implements TestQuestionService {
    @Resource
    TestQuestionDao testQuestionDao;
    public List<TestQuestion> getAllQuestionByPaperId(Integer paperid) {
        List<TestQuestion> questions = testQuestionDao.getAllQuestionByPaperId(paperid);
        if (questions!=null){
            for (TestQuestion question:questions) {
                int questionType = (int)question.getPaperQuestionBank();//得出题目的类型
                Object item = null;
                switch (questionType){
                    case 1:
                        item = testQuestionDao.getSelectById(question.getPaperQuestionQid());
                        break;
                    case 2:
                        break;
                }
                question.setPaperDetailQuestion(item);
            }
        }
        return questions;
    }
}
